<?php

class DataObject
{
	
	var $context;
	var $data;
	
	function DataObject(&$context){
		$this->context = &$context;
		$this->clean();
	}
	
	function setRow($rowData=NULL){
		if(is_array($rowData)){
			$field = $this->getField();
			for($i=0;$i<count($field);$i++){
				$this->set($field[$i]['name'],$rowData[$i]['dbname']);
			}
		}
	}
	
	function getRow(){
		return $this->data;
	}

	function set($field='',$value=''){
		$this->data[$field] = $value;
	}
	
	function get($field=''){
		return $this->data[$field];
	}
	
	function clean (){
		$this->data = array();
	}
	
	function isFieldExist($field){
		return isset($this->data[$field]);
	}
	
	function fromRecordSet(&$recordSet)
	{
		if($this->context->storage->isRecordSet($recordSet)){
			$this->data = $recordSet->getRowByIndex(1);
		}
	}
	
	function getRowForDataSet(){
		
	}
}

?>